<template>
  <view style="padding: 20rpx 32rpx;">
    <!-- /下面的商品 -->
    <view class="shoop">
      <view class="shoop_son" v-for="(item, index) in list" @click="toDetlis(item)" :key="index">
        <view class="" style="position: relative;">
          <!-- <view class="biaoqian">拼团</view> -->
          <image :src="baserUrl + item.image" style="width: 330rpx;height: 400rpx;" mode=""></image>
        </view>
        <view class="price">
          <view class="bt">{{ item.title }}</view>
          <view class="btPrice">
            <view class="" style="color: #5C5A55;font-size: 28rpx;">￥{{ item.price }}</view>
            <view class="" style="color: #ADADAA;font-size: 24rpx;font-weight: 400;text-decoration: line-through;">￥{{ item.original_price }}</view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      page: 1,
      list: [],
      baserUrl: this.$baseUrl
    };
  },
  onShow() {
    this.init();
  },
  onReachBottom() {
    if (this.list.length < this.page * 10) return;
    this.page++;
    this.init();
  },
  methods: {
    toDetlis(item) {
      uni.navigateTo({
        url: '/pages/details/details?id=' + item.id
      });
    },
    async init() {
      let m = await this.$api.vip_goods({ page: this.page, pagesize: 10 });
      if (this.page != 1) {
        this.list = [...this.list, ...m.data.data];
      } else {
        this.list = m.data.data;
      }
    }
  }
};
</script>

<style lang="scss">
* {
  box-sizing: border-box;
}
.shoop {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 10rpx;
  .shoop_son {
    width: 330rpx;
    margin-bottom: 32rpx;
    .biaoqian {
      position: absolute;
      bottom: 0;
      width: 330rpx;
      left: 0;
      background-color: #fcf6e3;
      height: 70rpx;
      z-index: 9999999;
      text-align: center;
      line-height: 70rpx;
      font-size: 24rpx;
      font-family: PingFang SC-Regular, PingFang SC;
      font-weight: 400;
      color: #8a7229;
    }
    .price {
      text-align: center;
      .bt {
        margin-top: 16rpx;
        margin-bottom: 8rpx;
        font-size: 28rpx;
        font-family: PingFang SC-Regular, PingFang SC;
        font-weight: 400;
        color: #0a0a09;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
      }
      .btPrice {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28rpx;
        font-family: PingFang SC-Bold, PingFang SC;
        font-weight: bold;
        color: #5c5a55;
        line-height: 48rpx;
      }
    }
  }
}
</style>
